<?php
include('../fns_all.php');

function get_user_by_id($id){
	$cxn = db_connect();
	$result = mysqli_query($cxn, "SELECT * FROM users WHERE id='$id'");
	$result = mysqli_fetch_assoc($result);
	return $result;
}

function update_user_with_imagename($id, $user_name, $fname, $lname, $email, $city, $country, $imagename){
	$cxn = db_connect();
	$query = "UPDATE users SET user_name='$user_name', first_name='$fname', last_name='$lname', email='$email', city='$city', country='$country', img_path='$imagename' WHERE id='$id'";
	return mysqli_query( $cxn, $query);
}

function update_user_without_imagename($id, $user_name, $fname, $lname, $email, $city, $country){
	$cxn = db_connect();
	return mysqli_query( $cxn, "UPDATE users SET user_name='$user_name', first_name='$fname', last_name='$lname', email='$email', city='$city', country='$country' WHERE id='$id'");
}

function delete_article($id){
	$cxn = db_connect();
	return mysqli_query ($cxn, "DELETE FROM articles WHERE id='$id'");
}
?>
